Sets our main struct and passes it to the parent class.
Creates a new GtkSourceView.
Creates a new #GtkSourceView widget displaying the buffer @buffer.
Keybinding signal to change case of the text at the current cursor position.
Keybinding signal to edit a number at the current cursor position.
Keybinding signal to join the lines currently selected.
Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter).
The signal is a keybinding which gets emitted when the user initiates moving a line.
Keybinding signal to move the cursor to the matching bracket.
The signal is a keybinding which gets emitted when the user initiates moving a word.
The signal is emitted to insert a new snippet into the view.
The signal is a key binding signal which gets emitted when the user requests a completion, by pressing <keycombo><keycap>Control</keycap><keycap>space</keycap></keycombo>.
Emitted when a the cursor was moved according to the smart home end setting.
Returns whether auto-indentation of text is enabled.
Returns the #GtkSourceBackgroundPatternType specifying if and how the background pattern should be displayed for this @view.
Gets the [class@Completion] associated with @view.
Gets the [property@View:enable-snippets] property.
Returns the [class@Gutter] object associated with @window_type for @view.
Returns whether the current line is highlighted.
Gets the [class@Hover] associated with @view.
Returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character.
Returns the number of spaces to use for each step of indent.
Gets the [property@View:indenter] property.
Returns whether when inserting a tabulator character it should be replaced by a group of space characters.
Gets attributes and priority for the @category.
Gets the position of the right margin in the given @view.
Returns whether line marks are displayed beside the text.
Returns whether line numbers are displayed beside the text.
Returns whether a right margin is displayed.
Returns %TRUE if pressing the Backspace key will try to delete spaces up to the previous tab stop.
Returns a [enum@SmartHomeEndType] end value specifying how the cursor will move when HOME and END keys are pressed.
Gets the [class@SpaceDrawer] associated with @view.
the main Gtk struct as a void*
Returns the width of tabulation in characters.
Get the main Gtk struct
Determines the visual column at @iter taking into consideration the [property@View:tab-width] of @view.
Inserts one indentation level at the beginning of the specified lines. The empty lines are not indented.
Inserts a new snippet at @location
If %TRUE auto-indentation of text is enabled.
Set if and how the background pattern should be displayed.
Sets the [property@View:enable-snippets] property.
If @highlight is %TRUE the current line will be highlighted.
If %TRUE, when the tab key is pressed when several lines are selected, the selected lines are indented of one level instead of being replaced with a \t character. Shift+Tab unindents the selection.
Sets the number of spaces to use for each step of indent when the tab key is pressed.
Sets the indenter for @view to @indenter.
If %TRUE a tab key pressed is replaced by a group of space characters.
Sets attributes and priority for the @category.
Sets the position of the right margin in the given @view.
If %TRUE line marks will be displayed beside the text.
If %TRUE line numbers will be displayed beside the text.
If %TRUE a right margin is displayed.
When set to %TRUE, pressing the Backspace key will try to delete spaces up to the previous tab stop.
Set the desired movement of the cursor when HOME and END keys are pressed.
Sets the width of tabulation in characters.
Removes one indentation level at the beginning of the specified lines.
the main Gtk struct
the main Gtk struct
Get the main Gtk struct
the main Gtk struct as a void*
Adds a child widget in the text buffer, at the given @anchor.
Adds @child at a fixed coordinate in the GtkTextView's text window.
Moves the given @iter backward by one display (wrapped) line.
Moves the given @iter backward to the next display line start.
Converts buffer coordinates to window coordinates.
Moves the given @iter forward by one display (wrapped) line.
Moves the given @iter forward to the next display line end.
Returns whether pressing the <kbd>Tab</kbd> key inserts a tab characters.
Gets the bottom margin for text in the @text_view.
Returns the GtkTextBuffer being displayed by this text view.
Determine the positions of the strong and weak cursors if the insertion point is at @iter.
Find out whether the cursor should be displayed.
Returns the default editability of the GtkTextView.
Gets the menu model that gets added to the context menu or %NULL if none has been set.
Gets a GtkWidget that has previously been set as gutter.
Gets the default indentation of paragraphs in @text_view.
Gets the input-hints of the GtkTextView.
Gets the input-purpose of the GtkTextView.
Retrieves the iterator at buffer coordinates @x and @y.
Retrieves the iterator pointing to the character at buffer coordinates @x and @y.
Gets a rectangle which roughly contains the character at @iter.
Gets the default justification of paragraphs in @text_view.
Gets the default left margin size of paragraphs in the @text_view.
Gets the GtkTextIter at the start of the line containing the coordinate @y.
Gets the y coordinate of the top of the line containing @iter, and the height of the line.
Gets the PangoContext that is used for rendering LTR directed text layouts.
Gets whether the GtkTextView uses monospace styling.
Returns whether the GtkTextView is in overwrite mode or not.
Gets the default number of pixels to put above paragraphs.
Gets the default number of pixels to put below paragraphs.
Gets the default number of pixels to put between wrapped lines inside a paragraph.
Gets the default right margin for text in @text_view.
Gets the PangoContext that is used for rendering RTL directed text layouts.
Gets the default tabs for @text_view.
Gets the top margin for text in the @text_view.
Fills @visible_rect with the currently-visible region of the buffer, in buffer coordinates.
Gets the line wrapping for the view.
Allow the GtkTextView input method to internally handle key press and release events.
Moves a mark within the buffer so that it's located within the currently-visible text area.
Updates the position of a child.
Move the iterator a given number of characters visually, treating it as the strong cursor position.
Moves the cursor to the currently visible region of the buffer.
Removes a child widget from @text_view.
Ensures that the cursor is shown.
Reset the input method context of the text view if needed.
Scrolls @text_view the minimum distance such that @mark is contained within the visible area of the widget.
Scrolls @text_view so that @iter is on the screen in the position indicated by @xalign and @yalign.
Scrolls @text_view so that @mark is on the screen in the position indicated by @xalign and @yalign.
Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.
Sets the bottom margin for text in @text_view.
Sets @buffer as the buffer being displayed by @text_view.
Toggles whether the insertion point should be displayed.
Sets the default editability of the GtkTextView.
Sets a menu model to add when constructing the context menu for @text_view.
Places @widget into the gutter specified by @win.
Sets the default indentation for paragraphs in @text_view.
Sets the input-hints of the GtkTextView.
Sets the input-purpose of the GtkTextView.
Sets the default justification of text in @text_view.
Sets the default left margin for text in @text_view.
Sets whether the GtkTextView should display text in monospace styling.
Changes the GtkTextView overwrite mode.
Sets the default number of blank pixels above paragraphs in @text_view.
Sets the default number of pixels of blank space to put below paragraphs in @text_view.
Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph.
Sets the default right margin for text in the text view.
Sets the default tab stops for paragraphs in @text_view.
Sets the top margin for text in @text_view.
Sets the line wrapping for the view.
Determines whether @iter is at the start of a display line.
Converts coordinates on the window identified by @win to buffer coordinates.
Gets emitted when the user asks for it.
Gets emitted to copy the selection to the clipboard.
Gets emitted to cut the selection to the clipboard.
Gets emitted when the user initiates a text deletion.
Emitted when the selection needs to be extended at @location.
Gets emitted when the user initiates the insertion of a fixed string at the cursor.
Gets emitted to present the Emoji chooser for the @text_view.
Gets emitted when the user initiates a cursor movement.
Gets emitted to move the viewport.
Gets emitted to paste the contents of the clipboard into the text view.
Emitted when preedit text of the active IM changes.
Gets emitted to select or unselect the complete contents of the text view.
Gets emitted when the user initiates settings the "anchor" mark.
Gets emitted to toggle the cursor-visible property.
Gets emitted to toggle the overwrite mode of the text view.
Subclass of [class@Gtk.TextView].
GtkSourceView is the main class of the GtkSourceView library. Use a [class@Buffer] to display text with a GtkSourceView.
This class provides:
- Show the line numbers; - Show a right margin; - Highlight the current line; - Indentation settings; - Configuration for the Home and End keyboard keys; - Configure and show line marks; - And a few other things.
An easy way to test all these features is to use the test-widget mini-program provided in the GtkSourceView repository, in the tests/ directory.
GtkSourceView as GtkBuildable
The GtkSourceView implementation of the [iface@Gtk.Buildable] interface exposes the [property@View:completion] object with the internal-child "completion".
An example of a UI definition fragment with GtkSourceView:
Changing the Font
Gtk CSS provides the best way to change the font for a GtkSourceView in a manner that allows for components like [class@Map] to scale the desired font.
If you need to adjust the font or size of font within a portion of the document only, you should use a [class@Gtk.TextTag] with the [property@Gtk.TextTag:family] or [property@Gtk.TextTag:scale] set so that the font size may be scaled relative to the default font set in CSS.